package com.example.dell.fastshopping.user.task;

import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.dell.fastshopping.R;

import butterknife.BindView;

/**
 * Created by ${YSH} on 2019/5/29.
 * 描述        ${TODO}
 * <p>
 * 更新者       $author$
 * 更新时间     $Data$
 * 描述         ${TODO}
 */
public class SharePopuWindow extends PopupWindow {

    private final View mMenuView;


    public SharePopuWindow(TaskActivity taskActivity, View.OnClickListener onClickListener) {
        LayoutInflater inflater = (LayoutInflater) taskActivity
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        mMenuView = inflater.inflate(R.layout.poupwindow_share, null, false);

        mMenuView.findViewById(R.id.cancle).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
        mMenuView.findViewById(R.id.share_weixin).setOnClickListener(onClickListener);
        mMenuView.findViewById(R.id.share_weixin_group).setOnClickListener(onClickListener);
        mMenuView.findViewById(R.id.share_qq).setOnClickListener(onClickListener);
        mMenuView.findViewById(R.id.share_qq_group).setOnClickListener(onClickListener);
        //设置SelectPicPopupWindow的View
        this.setContentView(mMenuView);
        //适配虚拟键
        this.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
        //设置SelectPicPopupWindow弹出窗体的宽
        this.setWidth(RelativeLayout.LayoutParams.MATCH_PARENT);
        //设置SelectPicPopupWindow弹出窗体的高
        this.setHeight(RelativeLayout.LayoutParams.WRAP_CONTENT);
        //设置SelectPicPopupWindow弹出窗体可点击
        this.setFocusable(true);
        //实例化一个ColorDrawable颜色为半透明
        ColorDrawable dw = new ColorDrawable(0x30000000); //android:background="#30000000"
        //设置SelectPicPopupWindow弹出窗体的背景
        this.setBackgroundDrawable(dw);
    }
}
